package experiment3;

import java.util.Scanner;

public class No_1 {
    public static void main(String []args)
    {
        System.out.println("请输入一个整数：");
        Scanner input=new Scanner(System.in);
        long num=input.nextLong();
        System.out.println("各位数字之和是： "+sumDigits(num));

    }

    public static int sumDigits(long n)
    {
        int sum=0;
        while (n!=0)
        {
            sum=sum+(int)n%10;
            n=n/10;
        }
        return sum;
    }

}
